Fix: Remove Extra Curly Braces from Data Table Variables in Scenario Outlines #111
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🐛 Problem
When using BDD scenario outlines with data tables containing variables from the Examples table, the generated Dart code incorrectly wrapped variable values in extra curly braces
{}, causing invalid Dart syntax as reported in #110.Before (Broken):
After (Fixed):
🔧 Root Cause & Solution
Issue Analysis
The bug was in
lib/src/scenario_generator.dartin the_replacePlaceholders()function at line 131:This function indiscriminately wrapped all placeholder substitutions in curly braces, including data table variables where they shouldn't be wrapped.
Core Fix
_replacePlaceholders()→_replacePlaceholdersInLine()LineType.dataTableStep)🧪 Testing & Validation
Comprehensive Test Coverage
'Scenario Outline with data table variables'test intest/data_tables_test.dartReal-World Example
📋 Files Changed
lib/src/scenario_generator.darttest/data_tables_test.dartexample/*✅ Verification
🎯 Impact
Resolves: Issue #110 - Data table variables incorrectly wrapped in curly braces
Enables: Proper BDD testing with scenario outlines using data tables
Maintains: Full backward compatibility with existing features
This fix ensures that generated Dart code is syntactically correct and tests can execute properly when using scenario outlines with data table variables.